<% layout('/layouts/default.html', {title: '考核任务信息表管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-tools pull-right">
			</div>
		</div>
		<#form:form id="inputForm" model="${dcSupExamInfo}" action="${ctx}/exam/dcSupExamInfo/save" method="post" class="form-horizontal">
			<div class="box-body">

				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('考核标题')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:hidden path="isNewRecord"/>
								<#form:hidden path="id" />
								<#form:input path="examTitle" class="form-control required"/>
								<#form:hidden path="examStatus" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('考核年度')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="examYear" items="${yearList}" blankOption="true" data-placeholder="请选择" itemLabel="yearLabel" itemValue="yearValue" class="form-control width-120 required" defaultValue="${currentYear}" />
							</div>
						</div>
					</div>
				</div>

				<% if(dcSupExamInfo.id != null && type == 0){ %>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('发布时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="createDate" class="form-control" />
							</div>
						</div>
					</div>
				</div>
				<% } %>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if(dcSupExamInfo.id == null){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"  onclick="changeStatus(2);"><i class="fa fa-check"></i> ${text('发 布')}</button>&nbsp;
						<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit2"  onclick="changeStatus(1);"><i class="fa fa-check"></i> ${text('临 时 保 存')}</button>&nbsp;
						<% } %>
						<% if(dcSupExamInfo.id != null && type == '1'){ %>
						<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit3"  onclick="changeStatus(2);"><i class="fa fa-check"></i> ${text('发 布')}</button>&nbsp;
						<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit4"  onclick="changeStatus(1);"><i class="fa fa-check"></i> ${text('临 时 保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
	$("#createDate").val("${@DateUtils.formatDate(dcSupExamInfo.createDate,'yyyy年MM月dd日')}");
	function changeStatus(val){
		$("#examStatus").val(val)
	}
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
</script>